import java.util.*;

public class Main {
    public static class Arr{
        int [] data;
        public Arr(int n) {
            Random random = new Random();
            data = new int[n];
            for(int i =0;i<n;i++) {
                data[i] = random.nextInt()%1000;
            }
        }

        void disp() {
            for(int i = 0;i<data.length;i++) {
                System.out.print(data[i]+" ");
            }
            System.out.println();
        }

        void reverse(){
            for (int i = 0; i <data.length / 2; i++) {
                int tmp = data[i];
                data[i] = data[data.length-1-i];
                data[data.length-1-i] = tmp;
            }
        }

        void mergeSort(int [] tmp,int begin,int end){
            if (end - begin <= 1) {
                return;
            }
            int mid = (end-begin) / 2;
            mergeSort(tmp, begin, begin + mid);
            mergeSort(tmp, begin + mid, end);
            int pt = begin;
            int p1 = begin, p2 = begin + mid;

            while (p1 < begin + mid  && p2 < end) {
                if (data[p1] > data[p2]) {
                    tmp[pt++] = data[p2++];
                }
                else {
                    tmp[pt++] = data[p1++];
                }
            }

            if (p1 < begin + mid) {
                while (p1 < begin + mid ) {
                    tmp[pt++] = data[p1++];
                }
            }

            if (p2 < end) {
                while (p2 <  end) {
                    tmp[pt++] = data[p2++];
                }
            }

            for (int i = begin; i < end; i++) {
                data[i] = tmp[i];
            }
        }
        void sort(){
            int [] tmp = new int[data.length];
            mergeSort(tmp,0, data.length);
            data = tmp;
        }

        int search(int key){
            for(int i = 0;i<data.length;i++)
            {
                if(data[i]==key)
                    return i;
            }
            return -1;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Arr tmp = new Arr(n);

        tmp.disp();

        tmp.reverse();
        tmp.disp();
        tmp.sort();
        tmp.disp();

        System.out.println(tmp.search(100));
    }
}